<template>
    <el-upload class="upload-box" :show-file-list="false" :http-request="onUploadRequest">
        <BaseButton type="primary" icon-name="icon-upload">上传</BaseButton>
    </el-upload>
</template>

<script setup lang="ts">
import { UploadRequestOptions } from 'element-plus'

const emit = defineEmits<{ onUpload: [action: 'upload', params: any] }>()

const onUploadRequest = async (options: UploadRequestOptions) => {
    emit('onUpload', 'upload', options.file)
}
</script>

<style lang="scss" scoped>
.upload-box {
    display: flex;
    margin: 0 12px;
}
</style>
